﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZHDJ.Core;
using ZHDJ.Core.Util;
using ZHDJ.Data.DataCaching;
using ZHDJ.Data.Models.Grassroots;
using ZHDJ.WebPage;

namespace ZHDJ.Web.Portal.Grassroots
{
    public partial class MassesVoiceDetail : PortalPage
    {
        #region 页面属性

        public string TrendID
        {
            get { return this.Request["id"] ?? "null"; }
        }

        public string ItemID { get; set; }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            ItemID = "";
            var model = PartyGrassrootsSuggestion.GetOne(TrendID).Tables[0];
            if (model.Rows.Count<1)
            {
                RedirectToDefault();
            }
            var dr = model.Rows[0];
            var item = DB.PartyGrassrootsGroupItems.Find(dr["ItemID"]);
            if (item != null) {
                litItemName.Text = item.ItemName;
                this.txtItemName.Text = item.ItemName;
            }

            ItemID = Convert.ToString(dr["ItemID"]);
            this.txtTitle.Text = Convert.ToString(dr["Title"]);
            this.txtUserName.Text = Convert.ToString(dr["UserName"]);
            this.txtCollectionTime.Text = Convert.ToDateTime(dr["CollectionTime"]).ToString("yyyy-MM-dd");
            this.txtMobileNo.Text = StringHelper.MobileNoHide(Convert.ToString(dr["MobileNo"]));

            this.txtContent.Text = Convert.ToString(dr["Content"]);
            this.txtStatus.Text = Convert.ToString(dr["StatusName"]);
            if (Convert.ToString(dr["Status"]) == "4")
            {
                replyDiv.Visible = true;
                this.litMessageWay.Text = Convert.ToString(dr["HandlerByName"]);
                this.litReplyTime.Text = Convert.ToDateTime(dr["ModifyTime"]).ToString("yyyy-MM-dd");
                this.litMassComment.Text = Convert.ToString(dr["MassCommentName"]);
                this.litGrassrootsAdmin.Text = Convert.ToString(dr["Receiver"]);
                this.litReply.Text = Convert.ToString(dr["Reply"]);
            }
            else
            {
                replyDiv.Visible = false;
            }

        }
    }
}